#include<bits/stdc++.h>
using namespace std;
#define _ << ' ' <<
#define pb push_back
#define eb emplace_back
#define all(x) begin(x), end(x)
#define mp make_pair
#define f first
#define s second
#define sz(x) int((x).size())
#define each(x,A) for(auto &x: A)
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
using ll = long long;
using db = long double;
using pl = pair<ll,ll>;
using pi = pair<int,int>;
using cd = complex<db>;
using vi = vector<int>;
using vpi = vector<pi>;
using vd = vector<db>;
using vl = vector <ll>;
using str = string;
template<class T> using V = vector<T>;
//const int MOD = 1e9+7;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '('; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << ')'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename T > ostream& operator<<(ostream &os, const set<T> &st){os << '{'; string sep; for(const auto &x: st) os << sep << x, sep = ", "; return os << '}';}
template<typename A, typename B> ostream& operator<<(ostream &os, const map<A,B> &mm){os << '{'; string sep; for(const auto &x: mm) os << sep << x, sep = ", "; return os << '}';}
void solve(){
int n; cin >> n;
vi a(n); each(x,a) cin >> x;
vi pos(n,0);
vi val(n,0);
vi mx(n);
int mxc = 0;
for(int i=n-1; i>=0; i--){
int v = a[i]+1;
if(v+i==n){
pos[i] = 1;
mx[i] = mxc + 1;
}
if(v+i<n){
if(pos[v+i]) pos[i] = pos[v+i]+1;
mx[i] = max(mxc+1,1+mx[v+i]);
}
if(v+i>n){
mx[i] = mxc+1;
}
mxc = max(mxc, pos[i]);
}
for(int i=0; i<n-1; i++){
if(pos[i+1]==a[i]) cout << 0 << ' ';
else if(mx[i+1]>=a[i] or pos[i+1]) cout << 1 << ' ';
else cout << 2 << ' ';
}
cout << endl;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t--) solve();
}
1671D - Insert a Progression | 1671A - String Building |
1671B - Consecutive Points Segment | 1671C - Dolce Vita |
1669G - Fall Down | 4D - Mysterious Present |
1316B - String Modification | 1204A - BowWow and the Timetable |
508B - Anton and currency you all know | 1672A - Log Chopping |
300A - Array | 48D - Permutations |
677C - Vanya and Label | 1583B - Omkar and Heavenly Tree |
1703C - Cypher | 1511C - Yet Another Card Deck |
1698A - XOR Mixup | 1702E - Split Into Two Sets |
1703B - ICPC Balloons | 1702F - Equate Multisets |
1700A - Optimal Path | 665C - Simple Strings |
1708A - Difference Operations | 1703E - Mirror Grid |
1042A - Benches | 1676B - Equal Candies |
1705B - Mark the Dust Sweeper | 1711A - Perfect Permutation |
1701B - Permutation | 1692A - Marathon |